package com.m3958.firstgwt.shared.type;

public enum VoteTplField {
	OPENSOURCE("openSource","开源",""),FREE("free","免费",""),
	LANG("lang","模板语言",""),TYPE("type","类型",""),
	DSP_TYPE("dspType","显示类型",""),FLAG("flag","标记",""),CONTENT("content","模板内容",""),
	TPL_USAGE("tplUsage","使用方法",""),OUT_SCRIPT("outScript","输出脚本模板",""),PREVIEW_URL("previewUrl","预览地址","");
	
	String ename;
	String cname;
	String alias;
	
	VoteTplField(String ename,String cname,String alias) {
		this.ename = ename;
		this.cname = cname;
		this.alias = alias;
	}
	public String getEname(){
		return this.ename;
	}
	public String getCname(){
		return this.cname;
	}
	public String getAlias(){
		return this.alias;
	}
	
    public static VoteTplField getFieldEnumByEname(String ename){
    	VoteTplField result = null;
    	for(VoteTplField lf : VoteTplField.values()){
    		if(ename.equals(lf.getEname())){
    			result = lf;
    			break;
    		}
    	}
    	return result;
    }
    
    public static VoteTplField getFieldEnumByCname(String cname){
    	VoteTplField result = null;
    	for(VoteTplField lf : VoteTplField.values()){
    		if(cname.equals(lf.getCname())){
    			result = lf;
    			break;
    		}
    	}
    	return result;
    }
    
    public static VoteTplField getFieldEnumByAlias(String alias){
    	VoteTplField result = null;
    	for(VoteTplField lf : VoteTplField.values()){
    		if(alias.equals(lf.getAlias())){
    			result = lf;
    			break;
    		}
    	}
    	return result;
    }
}
